Skip to content

feat: custom [indices] in mcpp.toml with project-level isolation#39

Merged
Sunrisepeak merged 1 commit into
mainfrom
feat/custom-indices
May 15, 2026
Merged

feat: custom [indices] in mcpp.toml with project-level isolation#39
Sunrisepeak merged 1 commit into
mainfrom
feat/custom-indices

Conversation

@Sunrisepeak
Copy link
Copy Markdown
Member

Summary

  • Implement [indices] section in mcpp.toml and config.toml for configuring custom package index repositories
  • Support short form (acme = "git@...") , long form (acme = { url = "...", tag = "v2.0" }) , and local path (local = { path = "/..." })
  • Project-level isolation via XLINGS_PROJECT_DIR: custom indices get their own .mcpp/ directory, while built-in indices (mcpplibs) stay global
  • Users need zero xlings knowledge — mcpp auto-manages .mcpp/.xlings.json

Changes

File What
src/pm/index_spec.cppm IndexSpec struct (name, url, rev, tag, branch, path) with is_local(), is_pinned(), is_builtin() helpers
src/manifest.cppm Manifest::indices field + [indices] TOML parsing (short/long/path forms)
src/config.cppm GlobalConfig::indices + [indices] parsing in config.toml + ensure_project_index_dir() + make_project_xlings_env()
src/xlings.cppm Env::projectDir field + build_command_prefix() dual mode (global vs project-level)
src/pm/package_fetcher.cppm read_xpkg_lua_from_path() for local path index direct reading
src/cli.cppm cmd_index_list shows project indices + prepare_build calls ensure_project_index_dir
tests/e2e/42_custom_local_index.sh E2E test: local path index + short/long form parsing + mcpp index list verification

Design

  • [indices] key = index name (maps to xlings repo {name, url}), not namespace
  • Namespace comes from xpkg.lua's internal namespace field; falls back to index name if absent
  • Built-in indices stay global (~/.mcpp/registry/), custom indices use project-level .mcpp/ via XLINGS_PROJECT_DIR (verified: additive mode, global repos remain visible)
  • Package descriptor format: only xpkg.lua (no new format, no ecosystem breakage)
  • See .agents/docs/2026-05-16-indices-enhancement-design.md for full design

Test plan

  • mcpp build compiles successfully with all changes
  • E2E test 42_custom_local_index.sh passes (local path index parsing + index list)
  • Existing E2E tests 01_help_and_version.sh, 11_index_list.sh pass (no regression)
  • Manual verification: mcpp index list shows project indices when [indices] is configured

…evel isolation

Implement the first phase of custom package index support:

- Fill in IndexSpec struct in src/pm/index_spec.cppm (name, url, rev, tag,
  branch, path) with is_local/is_pinned/is_builtin helpers
- Parse [indices] section in mcpp.toml (short string form, inline table
  with url/rev/tag/branch/path, and local path form)
- Parse [indices] section in config.toml (global config)
- Add indices field to Manifest and GlobalConfig structs
- Add projectDir field to xlings::Env; build_command_prefix conditionally
  sets XLINGS_PROJECT_DIR for project-level isolation
- Add ensure_project_index_dir() to create .mcpp/.xlings.json with custom
  index entries when non-builtin indices are configured
- Add Fetcher::read_xpkg_lua_from_path() for local path index support
- Update cmd_index_list to display project-level indices from mcpp.toml
- Update prepare_build to set up .mcpp/ directory for custom indices
- Add E2E test (42_custom_local_index.sh) verifying parsing + display
@Sunrisepeak Sunrisepeak merged commit dc8f26b into main May 15, 2026
1 check passed
@Sunrisepeak Sunrisepeak mentioned this pull request May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant